package main

import (
	"log"
	"net"
	"strconv"
)

func main1() {
	ip := "127.0.0.1"
	port := 8080

	addr, err := net.ResolveTCPAddr("tcp", ip+":"+strconv.Itoa(port))

	conn, err := net.DialTCP("tcp", nil, addr)

	resp, err := conn.Write([]byte("i am client"))
	log.Printf("send %d to server: ", resp)

	response := make([]byte, 256)
	_, err = conn.Read(response)
	log.Printf("receive from server: %s", string(response))

	conn.Close()
}
